<template>
  <div class="chat-conversation">
    <div class="message-content">
      <div v-for="(item, index) in messageList" :key="index" class="chat-record">
        <div class="record-info" :class="item.senderId === nimInfo.accountId ? 'user' : 'bot'">
          <div class="avatar"><el-avatar shape="square" :size="50" /></div>
          <div class="message">{{ item.text }}</div>
        </div>
      </div>
    </div>
  </div>
</template>
<script setup lang="ts">
const props = defineProps({
  messageList: {
    type: Array,
    default: () => [],
  },
});
</script>

<style scoped lang="scss">
.chat-conversation {
  height: 100%;
  flex: 1;
  border-radius: 12px;
  background: #fff;
  display: flex;
  flex-direction: column;
  .message-content {
    flex: 1;
    padding: 10px;
    overflow-y: auto;
    .chat-record {
      margin: 10px 0;
      .record-info {
        display: flex;
        align-items: center;
        .avatar {
          width: 46px;
          height: 46px;
        }
        .message {
          font-size: 14px;
          background: #e5e5ea;
          border-radius: 12px;
          padding: 8px 12px;
          max-width: 60%;
        }
      }
      .bot {
        .message {
          background: #e4e7eb;
          color: black;
        }
        .avatar {
          margin-right: 10px;
        }
      }
      .user {
        justify-content: flex-end;
        .message {
          background: #3780e8;
          color: #ffffff;
        }
        .avatar {
          order: 1;
          margin-left: 10px;
        }
      }
    }
  }
  .message-controls {
    border-top: 1px solid #e6e8eb;
    height: 160px;
    .tools-wrapper {
      height: 33px;
      padding: 10px;
      font-size: 14px;
    }
    .input-wrapper {
      padding: 10px;
      .chat-op {
        font-size: 14px;
        color: #ccc;
        text-align: right;
      }
    }
  }
}
</style>
